<template>
	<div class="public-attribute">
		
		<div class="header-fixed">
			<eight-header></eight-header>
			<eight-nav></eight-nav>
		</div>
		
		<eight-list 
					:eightList='eightList'
		>
		</eight-list>

		<div id="box"></div>
	</div>
</template>

<script>
	import axios from 'axios'
	import EightHeader from '../../common/CommonHeader'
	import EightNav from '../../common/CommonNav'
	import EightList from './components/List'
	export default {
		name: 'hot',
		components: {
			EightHeader,
			EightNav,
			EightList
		},
		data () {
			return {
				eightList: []
			}
		},
		methods: {			
			getEightData () {	
				
// 				function PublicAjax (method, url, asy = false) {					
// 					this.method = method
// 					this.url = url
// 					this.asy = asy					
// 				}			
// 				PublicAjax.prototype.mAjax = function () {
// 					var ajax = new XMLHttpRequest()
// 						ajax.open(this.method, this.url, this.asy)
// 						
// 						ajax.onreadystatechange = function () {
// 							if (ajax.readyState == 4) {
// 								if (ajax.status == 200) {
// 									
// 									let dataObj = JSON.parse(ajax.responseText),
// 										dataRes = dataObj.data
// 										
// 									for (var i = 0; i < dataRes.length; i++) {
// 										console.log('第' + [i] + '个新闻标题：' + dataRes[i].list_title)
// 									}
// 								}
// 							}
// 						}
// 						ajax.send()
// 				}
// 				
// 				var e = new PublicAjax('get', '/eight_lists?module=eight')
// 				e.mAjax()
// 				
// 				var v = new PublicAjax('get', '/video_lists')
// 				v.mAjax()
				
				axios({
					method: 'get',
					url: '/eight_lists?module=eight'
				})
				.then( response=> {
					let res = response.data
					if (res.status == 0) {
						this.eightList = res.data
					}
				})
				.catch( err=> {
					console.log('REQUEST ERROR:' + err)
				})	
			}
		},
		mounted () {
			this.getEightData()
		}
	}
	//http://5b0988e595225.cdn.sohucs.com/images/20190112/b85341d1e47d45ee9a2b3b31b13a9a42.jpeg
	//https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1554647347810&di=41cda4669710f33e5103e87321781398&imgtype=0&src=http%3A%2F%2Fupload.ellemen.com%2F2017%2F0926%2F1506417856723.jpg
</script>

<style lang="stylus" scoped>
	.boxDiv
		width:400px
		height:200px
		background:#ccc
		margin:100px auto
		.boxButton
			font-size:32px
</style>